﻿using System.Text;

namespace buildem
{

    internal class Program
    {
        const string outfile = "embuild.bat";
        static void Main(string[] args)
        {
            Console.WriteLine("==>gen " + outfile);

            BuildFiles files = new BuildFiles();
            files.hfiles = BuildFiles.ParseList(System.IO.Directory.GetFiles("./", "*.h", SearchOption.AllDirectories));
            files.hppfiles = BuildFiles.ParseList(System.IO.Directory.GetFiles("./", "*.hpp", SearchOption.AllDirectories));
            files.cfiles = BuildFiles.ParseList(System.IO.Directory.GetFiles("./", "*.c", SearchOption.AllDirectories));
            files.cppfiles = BuildFiles.ParseList(System.IO.Directory.GetFiles("./", "*.cpp", SearchOption.AllDirectories));
            files.jsfiles = BuildFiles.ParseList(System.IO.Directory.GetFiles("./", "*.js", SearchOption.AllDirectories));

            if (System.IO.File.Exists(outfile))
                System.IO.File.Delete(outfile);

            System.IO.File.WriteAllText(outfile, files.GenBuildBat());
            Console.WriteLine("==>call "+ outfile);
            files.Run(outfile);
        }

    }
}